<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // ES6之前
    const obj = {
      name: 'why',
      fn: 'aaa'
    } 
    // 想要添加一个新的属性 name 该属性会覆盖原有的name属性
    obj.name = 'kobe'

    // ES6之后可以使用Symbol生成一个独一无二的值
    const s1 = Symbol()
    const obj1 = {
      [s1]:'aaa'
    }
    console.log(obj1)

    const s2 = Symbol()
    obj1[s2] = 'bbb'
    console.log(obj1)
    function foo(obj1){
      const sKey = Symbol()
      obj1[sKey] = function(){}
    }
    foo(obj1)
    console.log(obj1)



  </script>
</body>

</html>